package com.rightsidetech.activity.mapper;

import com.rightsidetech.activity.dto.request.ActUserCouponReq;
import com.rightsidetech.activity.dto.response.*;
import com.rightsidetech.activity.entity.ActCouponGetRecord;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ActCouponGetRecordMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ActCouponGetRecord record);

    int insertSelective(ActCouponGetRecord record);

    ActCouponGetRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ActCouponGetRecord record);

    int updateByPrimaryKeyWithBLOBs(ActCouponGetRecord record);

    int updateByPrimaryKey(ActCouponGetRecord record);

    List<ActReceivePageResp> receivePage(ActUserCouponReq req);

    Long receivePage_COUNT(ActUserCouponReq req);

    int selectCountByActivityIdAndUserId(@Param("activityId")Long activityId,@Param("userId") Long userId);

    int selectCountByActivityIdAndUserIdAndStatus(@Param("activityId")Long activityId,@Param("userId") Long userId, @Param("status") Byte status);

    List<ActCouponCountInfoResp> cardBag(@Param("userInfoId")Long userInfoId, @Param("type") Byte type);

    ActCouponCountInfoResp codeInfo(@Param("code") String code,@Param("userInfoId") Long userInfoId);

    List<ActCouponAllResp> selectCanUseCoupon(@Param("userInfoId") Long userInfoId, @Param("consumeAmount") Long consumeAmount);

    //修改作废的优惠券
    int updateStatusByActivityIdAndStatus(@Param("activityId") Long activityId);

    //最早没有使用的优惠券
    ActCouponGetRecord selectNewByActivityIdAndStatus(@Param("activityId") Long activityId);

    ActCouponGetRecord selectByCode(@Param("code") String code);

    ActCouponGetRecord selectByCodeAndStatusAndDate(@Param("code") String code);

    List<ActUserCouponResp> selectList(ActUserCouponReq req);

    List<ActUserGetCouponResp> selectUserList(ActUserCouponReq req);

    Long selectByActivityId(@Param("activityId") Long activityId,@Param("status") Byte status);

}